home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 16815 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  49 lines

  1. Newsgroups: comp.lang.c++
  2. Path: newsfeed.ed.ac.uk!hwcee!ceeab1
  3. From: ceeab1@cee.hw.ac.uk (Alistair Biggin)
  4. Subject: HELP WITH INHERITANCE NEEDED
  5. Message-ID: <DpMEDH.HL@cee.hw.ac.uk>
  6. Sender: news@cee.hw.ac.uk (News Administrator)
  7. Organization: Dept of Computing and Electrical Engineering, Heriot-Watt University
  8. X-Newsreader: TIN [version 1.2 PL2]
  9. Date: Wed, 10 Apr 1996 00:22:28 GMT
  10.  
  11. I have a class heirachy that looks like this
  12.  
  13.    classA< type >
  14.    {
  15.      public :
  16.        otherClass* pointer ;
  17.  
  18.        classA()
  19.        {
  20.          pointer = new otherClass ;
  21.        }
  22.    }
  23.    
  24.    classB< type >
  25.    {
  26.       public :
  27.         classB():classA< type >()
  28.    }
  29.  
  30.    classC< type >
  31.    {
  32.       public :
  33.         classC():classB< type >()
  34.    }
  35.  
  36. When I create an object of classC, the pinter gets set in the constructor of
  37. classA, but when a method from classB is called, the pointer is NULL and the
  38. method fails....
  39.  
  40. Why ? 
  41.      
  42. --------------------------------------------------------------------------
  43.  
  44.    Alistair Biggin                                      A.Biggin@hw.ac.uk
  45.    BEng Information Systems Engineering (3rd Year)
  46.    Heriot-Watt University, Edinburgh, Scotland                  WWWWW
  47.                                                                 |O O| 
  48. -------------------------------------------------------------oOO--0--OOo--
  49.